#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
	int a = 0;
	int b = 0;
	int c = 0;
	int d = 0;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int h = c - (a + 1);
	int min = d + 60 - b;
	if (min>=60) {
		min -= 60;
		h += 1;
	}
	printf("%d ",h);
	printf("%d\n",min);
	return 0;
}